package com.project.yuepai.config;


import com.project.yuepai.interceptor.ResourceInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.HiddenHttpMethodFilter;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


@Configuration
@Component

public class WebMvcConfig implements WebMvcConfigurer {
    //支持restful风格
    @Bean
    public HiddenHttpMethodFilter hiddenHttpMethodFilter() {
        return new HiddenHttpMethodFilter();
    }

    //添加Interceptors
    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        registry.addInterceptor(new ResourceInterceptor()).excludePathPatterns("/static/**");  //静态资源不拦截

    }




}
